package top.xiesen.generic;
/**
 * 1.获取值:强制类型转换
 * 2.类型检查 :避免出现错误 java.lang.ClassCastException
 * @author Allen
 *
 */
public class App {

	public static void main(String[] args) {
		Object obj = 80;
		int score = (int)obj; // Object --> Integer --> int 自动拆箱
		System.out.println(score);
		
		// 存入整数  	int --> Integer -->Object 自动装箱
		Student stu = new Student(80,90);
//		stu.getJavase();
		int javaseScore = (int)stu.getJavase();
		String oracleScore = null;
		if(stu.getOracle() instanceof String){
			
			oracleScore = (String)stu.getOracle();
		}
		
		System.out.println("分数为:" + javaseScore + "," + oracleScore);
	}
}
